<template>
  <div class="login-wrap">
    <div class="mod-setting">
      <theme-set class="sets"></theme-set>
      <langs-set class="sets"></langs-set>
    </div>



    <div class="model"></div>
    <!--<b @click="btn">获取</b>-->
    <div class="ms-title">{{$t('Login.title')}}</div>
    <div class="ms-login">
      <el-form :model="ruleForm2" :rules="rules2" ref="ruleForm2" label-position="left" label-width="0px" class="demo-ruleForm login-container">
        <!--<h3 class="title">系统登录</h3>-->
        <el-form-item prop="userName">
          <el-input type="text" v-model="ruleForm2.userName" auto-complete="off" :placeholder="$t('Login.name')"></el-input>
        </el-form-item>
        <el-form-item prop="userPwd">
          <el-input type="password" v-model="ruleForm2.userPwd" auto-complete="off" :placeholder="$t('Login.pwd')"></el-input>
        </el-form-item>
        <el-checkbox v-model="checked" checked class="remember">{{$t('Login.rpwd')}}</el-checkbox>
        <el-form-item style="width:100%;">
          <el-button type="primary" style="width:100%;" @click.native.prevent="handleSubmit2" :loading="logining">{{$t('public.btn1')}}</el-button>
          <!--<el-button @click.native.prevent="handleReset2">重置</el-button>-->
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
  import {insurance} from '../../api/insurance';
  import ThemeSet from "../componentChild/themeSet";
  import LangsSet from "../componentChild/langsSet";
  export default {
    components: {LangsSet, ThemeSet},
    comment:{
      themecolor:require('../componentChild/themeSet'),
      langsSet:require('../componentChild/langsSet')
    },
    data() {
      return {
        logining: false,
        ruleForm2: {
            userName: 'admin',
            userPwd: '1qaz2wsx'
        },
        rules2: {
            userName: [
            { required: true, message: '请输入账号', trigger: 'blur' },
          ],
            userPwd: [
            { required: true, message: '请输入密码', trigger: 'blur' },
          ]
        },
        checked: true
      };
    },
    methods: {
      handleSubmit2(ev) {
        var that = this;
          that.$refs.ruleForm2.validate((valid) => {
          if (valid) {
              // that.logining = true;
              var data = JSON.stringify({ usrname: that.ruleForm2.userName, pwd: that.ruleForm2.userPwd });
            // that.logining = false;
            // this.$api.post('user/login.do(地址)', {"参数名": "参数值"
            // }, response => {
            //   if (response.status >= 200 && response.status < 300) {
            //     console.log(response.data);
            //   } else {
            //     console.log(response.message);
            //   }
            // });

            insurance.insuranceLogin(data).then(function(res) {
              console.log(res);
            });



          } else {
            return false;
          }
        });
      },
      btn(){
        var a = sessionStorage.getItem('langs');
        console.log('数据-----------------------------');
        console.log(JSON.parse(sessionStorage.getItem('user')));
      }
    },
    mounted(){
        if (sessionStorage.getItem('user')) {
            this.ruleForm2.userName = JSON.parse(sessionStorage.getItem('user')).usrname;
            this.ruleForm2.userPwd = JSON.parse(sessionStorage.getItem('user')).pwd;
        }
    }
  }
</script>


<style >

</style>
